package com.dyz.leetcode._02_string;

public class _459_repeatedSubstringPattern {
    //滑动窗口
    public boolean repeatedSubstringPattern(String s) {
        int length = s.length();

        for(int win = 1; win*2<=length; win++){
            if(length%win==0){
                boolean matched = true;
                int j=0;
                for (int i = win; i < length; i++, j++) {
                    if(s.charAt(i)!=s.charAt(j)){
                        matched=false;
                        break;
                    }
                }
                if(matched==true){return true;}
            }
        }
        return false;
    }
}
